import { getAllRegionList } from '@fl/api/xf-api'

export function useCity() {
type AreaItem = {
    areaName: string
    areaCode: string
    // 其他可能的属性...
}

type OptionItem = {
    label: string
    value: string
}

const cityOptions = ref<OptionItem[]>([])
async function queryCityList() {
    const options: OptionItem [] = []
    await getAllRegionList().then((res) => {
        const dataList = res.data
        dataList.forEach((v: AreaItem) => {
            options.push({ label: v.areaName, value: v.areaCode, children: v.children })
        })
        cityOptions.value = options
    })
}
return { cityOptions, queryCityList }
}
